<xsl:stylesheet version="1.1"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:our="http://www.ouroboroswiki.com/ext">

  <xsl:output method="xml" indent="yes" />
  
    <xsl:include href="view/include.xsl"/>
  
  <xsl:param name="input-mime-type">text/plain</xsl:param>
  <xsl:param name="input-path"/>
  <xsl:param name="input-repo"/>
  <xsl:param name="input-editable">false</xsl:param>

  <xsl:template match="/">
    <div>
      <xsl:choose>
        <xsl:when test="contains($input-mime-type,'/html')">
          <xsl:copy-of select="content/original/*" />
        </xsl:when>
        <xsl:when test="$input-mime-type = 'image/svg+xml'">
          <!-- embed a link to the image rather than display the text -->
          <our:image mode="replace" repo="svgpng"/>
        </xsl:when>
        <xsl:when test="contains($input-mime-type, 'image/')">
          <our:image 
          	mode="replace"
          	alt="{$input-path}.{$input-repo}"
          	title="{content/@name}.{content/@repo}"/>
        </xsl:when>
        <xsl:otherwise>
          <pre>
            <xsl:value-of select="content/escaped" />
          </pre>
        </xsl:otherwise>
      </xsl:choose>
    </div>
  </xsl:template>
  
</xsl:stylesheet>